package com.huan.order.controller;

import com.huan.api.StorageFeignApi;
import com.huan.order.entity.SeataOrder;
import com.huan.order.mapper.UserMapper;

import com.huan.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;

    @Autowired
    private UserMapper userMapper;


    @Autowired
    private StorageFeignApi storageFeignApi;



    @GetMapping("/createOrder")
    public String createOrder(){
        SeataOrder seataOrder = new SeataOrder();
        seataOrder.setCount(1);
        seataOrder.setMoney(BigDecimal.valueOf(100));
        seataOrder.setUserId(1001l);
        seataOrder.setProductId(10086l);
        orderService.createOrder(seataOrder);
        return "Ok";
    }

    @GetMapping("/test")
    public String test(){
        String result = storageFeignApi.TestOpenFeign("111");
        return result;
    }

    @GetMapping("/gateway")
    public String gateway(){

        return "hello gateway";
    }
}
